Skip to content

otel 수신 데이터 90일 지나면 Vercel Blob 으로 이관하는 Cron - #53

Merged
hsol merged 2 commits into
mainfrom
chore/otel-retention
Nov 15, 2026
Merged

hsol merged 2 commits into
mainfrom
chore/otel-retention

Conversation

@hsol

@hsol hsol commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

무엇을

otel.proofer.tech 수신 데이터가 Neon 에 계속 쌓이는 것을 막되, 지우지 않고 Vercel Blob 으로 옮긴다.

  • GET /api/cron/otel-retention: otel_log_record, otel_raw_batch 에서 received_at 이 보관 기간보다 오래된 행을 5000건씩 읽어
    • 테넌트/날짜별로 묶어 gzip NDJSON 으로 proofer-otel-archive(private Blob 스토어, icn1)에 올린다
      otel/{tenant}/{yyyy}/{mm}/{dd}/{table}-{첫 id}-{끝 id}.ndjson.gz
    • 업로드가 끝난 묶음의 행만 DB 에서 지운다. 실패한 묶음은 남아 다음 실행에서 다시 옮긴다
    • 파일 이름이 행 id 범위라 재시도해도 같은 파일을 덮어써 중복이 생기지 않는다
  • 보관 기간: OTEL_RETENTION_DAYS (기본 90, 7 미만이면 기본값)
  • vercel.json cron: 매일 0 19 * * * (04:00 KST)
  • 인증: 운영 환경변수에 이미 있는 CRON_SECRET. 스토어 토큰은 OTEL_ARCHIVE_READ_WRITE_TOKEN(스토어를 프로젝트에 연결하며 생성, 기존 represent-blob 의 BLOB_READ_WRITE_TOKEN 과 분리)
  • private 업로드를 위해 @vercel/blob 0.22.3 -> 2.9.0. 기존 사용처 scripts/blog/cli.ts 는 타입체크 통과
  • /api 경로는 proxy 의 서브도메인 rewrite 와 점검 모드를 타지 않아 Cron 이 그대로 닿는다

검증

  • tsc --noEmit, eslint, jest 153건 통과
  • 선택/삭제 SQL 은 운영 DB 에서 트랜잭션 안에서 실행 후 ROLLBACK 으로 확인
  • 지금은 90일 지난 행이 없어 실제 업로드는 아직 일어나지 않는다. 머지 후 수동 실행하면 rows: 0 이 정상이고, 첫 실제 이관은 2027-02 중순

https://claude.ai/code/session_01GbwQAmvPRPEB5MErYrrUqn


Generated by Claude Code

/api/cron/otel-retention 이 otel_log_record 와 otel_raw_batch 에서 received_at 이 보관 기간보다
오래된 행을 5000건씩 지운다. 기간은 OTEL_RETENTION_DAYS(기본 90, 최소 7). Vercel Cron 이 매일
19:00 UTC(04:00 KST)에 부르고 CRON_SECRET 으로 요청을 확인한다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GbwQAmvPRPEB5MErYrrUqn
@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
proofer Ready Ready Preview Nov 15, 2026 12:33am UTC

Request Review

proofer-otel-archive(private Blob 스토어)에 테넌트/날짜별 gzip NDJSON 으로 올리고, 올라간 묶음의 행만
DB 에서 뺀다. 업로드가 실패하면 그 묶음은 남겨 두어 다음 실행에서 다시 옮긴다. 파일 이름이 행 id 범위라
재시도해도 같은 파일을 덮어쓴다.

private 업로드를 위해 @vercel/blob 을 0.22.3 에서 2.9.0 으로 올린다. 기존 사용처 scripts/blog/cli.ts 는
그대로 타입체크를 통과한다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GbwQAmvPRPEB5MErYrrUqn
@hsol hsol changed the title otel 수신 데이터 90일 보관 정리 Cron otel 수신 데이터 90일 지나면 Vercel Blob 으로 이관하는 Cron Nov 15, 2026
@hsol
hsol merged commit 3d7af5a into main Nov 15, 2026
6 checks passed
@hsol
hsol deleted the chore/otel-retention branch November 15, 2026 00:38

This branch was successfully deployed

1 active deployment
Preview — 3f76b16a Deployed Nov 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants